package com.lotterymanage.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lotterymanage.dao.InsideUserDao;
import com.lotterymanage.domain.InsideUser;
import com.lotterymanage.service.InsideUserService;

/**
 * 内部用户service实现类.
 * @author lxz
 * @date Apr 20, 2010
 */
@Service("insideUserService")
public class InsideUserServiceImpl implements InsideUserService {

    @Autowired
    private InsideUserDao insideUserDao;
    /**
     * 检查用户是否被冻结.
     * @param insideUser InsideUser
     * @return true false
     */
    @Override
    public boolean isFreezeUser(final InsideUser insideUser) {
        if (("1").equals(insideUser.getUserStateID())) {
            return true;
        }
        return false;
    }

    /**
     * 用户登录.
     * @param insideUser InsideUser
     * @param password String 用户输入的密码
     * @return true false
     */
    @Override
    public boolean isLogin(final InsideUser insideUser, final String password) {
//        MD5 md = new MD5();
//        String passwd = md.getkeyBeanofStr(password.trim());
//
//        if (insideUser == null || !passwd.equals(insideUser.getPassWord())) {
//            return false;
//        }
        return true;
    }

    /**
     * 根据accounts查询insideUser记录.
     * @param accounts String
     * @return insideUser
     */
    @Override
    public InsideUser findInsideUserByAccounts(final String accounts) {
        InsideUser insideUser = new InsideUser();
        insideUser.setAccounts(accounts);
        return this.insideUserDao.selectInsideUserByAccounts(insideUser);
    }
}
